package com.rany.day10.demo07;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadPool {
    public static void main(String[] args) {
        //创建一个包含3个线程的线程池
        ExecutorService es = Executors.newFixedThreadPool(3);
        //调用submit方法，传递线程任务，开启线程，执行run方法
        es.submit(new RunnableImpl());
        es.submit(new RunnableImpl());
        es.submit(new RunnableImpl());
        es.submit(new RunnableImpl());

        //调用shutdown方法销毁线程池，不建议使用
        es.shutdown();
        es.submit(new RunnableImpl());
    }
}
